/*
 * MVCME framework (www.radoslaw.biz/mvcme)
 * This framework is an attempt of creating MVC pattern for Java ME.
 * Feel free to change and distribute code and binaries of this project.
 * Should you want to provide any feedback, contact me at kowalski@radoslaw.biz
 */

package biz.radoslaw.mvcme.command;

import biz.radoslaw.mvcme.view.View;

public class DisplayViewCommand extends AbstractCommand {
    private View view;
    private boolean closeCurrentView = false;
    public void setCloseCurrentView(boolean closeCurrentView) {
        this.closeCurrentView=closeCurrentView;
    }
    public void setView(View view) {
        this.view=view;
    }
    public void run() throws IllegalAccessException, InstantiationException {
        if (closeCurrentView) {
            CloseViewCommand closeViewCommand = (CloseViewCommand) (CommandFactory.create(CloseViewCommand.class));
            closeViewCommand.run();
        }
        this.controller.show(view);
    }

}
